<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class MsgTask extends Model
{
    use SoftDeletes;
    protected $table = 'msg_task';

    public function sendLog()
    {
//        return $this -> hasMany(MsgTaskLog::class , "account_email" , "email") -> where("status" , 0);

        return $this -> hasMany(MsgTaskLog::class , "msg_task_id" , "id") -> where("status" , 0);
    }
    public function setPicturesAttribute($pictures)
    {
        if (is_array($pictures)) {
            $this->attributes['pictures'] = json_encode($pictures);
        }
    }

    public function getPicturesAttribute($pictures)
    {
        return json_decode($pictures, true);
    }
}
